package gui;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import dbConnection.Database;

public class AdminView extends JPanel {
    /**
     * 
     */
    private static final long serialVersionUID = 8118874251871323333L;
    public Database DB;
    public MainScreen app;
    
    public AdminView(final MainScreen app, Database dB2) {
	this.app = app;
	this.DB = dB2;
	
	setLayout(new BorderLayout());
	
	//tabs for two search views
	JTabbedPane tabs = new JTabbedPane();
	tabs.add("User Search", new AdminUserSearchPanel(dB2, app));
	tabs.add("Inventory Search", new AdminInventorySearchPanel(dB2));
	add(tabs, BorderLayout.CENTER);
	
	JPanel buttonPanel = new JPanel();
	buttonPanel.setLayout(new BoxLayout(buttonPanel,BoxLayout.X_AXIS));
	final JButton logout = new JButton("Logout");
	logout.addActionListener(new ActionListener() {
	   public void actionPerformed(ActionEvent e) {
//	       app.remove(app.admin);
	       app.showLogin();
//	       app.adminLogout();
	   }
	});
	
	buttonPanel.add(logout);
    }
}
